package com.pmsystem.exceptions;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class ExceptionsHandler  {

	@ExceptionHandler(MyAppException.class)
	public ModelAndView resolveException(MyAppException ex) {
		
		ModelAndView mv = new ModelAndView();
		mv.addObject("err_msg", ex.getMessage());
		mv.setViewName("app_error");
		return mv;
	}

}
